package c.e.a.b.f.b;

import android.os.Bundle;
import b.i.b.f;
import c.b.a.a.a;
import com.google.android.gms.measurement.internal.zzap;
import com.google.android.gms.measurement.internal.zzaq;
import com.huawei.hms.framework.common.ContainerUtils;
import java.util.ArrayList;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class o3 extends r5 {
    public static final AtomicReference<String[]> c = new AtomicReference();
    public static final AtomicReference<String[]> d = new AtomicReference();
    public static final AtomicReference<String[]> e = new AtomicReference();

    public o3(u4 u4Var) {
        super(u4Var);
    }

    public static String v(String str, String[] strArr, String[] strArr2, AtomicReference<String[]> atomicReference) {
        Objects.requireNonNull(atomicReference, "null reference");
        f.J(strArr.length == strArr2.length);
        for (int i = 0; i < strArr.length; i++) {
            if (t9.q0(str, strArr[i])) {
                synchronized (atomicReference) {
                    String[] strArr3 = (String[]) atomicReference.get();
                    if (strArr3 == null) {
                        strArr3 = new String[strArr2.length];
                        atomicReference.set(strArr3);
                    }
                    if (strArr3[i] == null) {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.append(strArr2[i]);
                        stringBuilder.append("(");
                        stringBuilder.append(strArr[i]);
                        stringBuilder.append(")");
                        strArr3[i] = stringBuilder.toString();
                    }
                    str = strArr3[i];
                }
                return str;
            }
        }
        return str;
    }

    public final boolean r() {
        return false;
    }

    public final String s(Bundle bundle) {
        if (bundle == null) {
            return null;
        }
        if (!z()) {
            return bundle.toString();
        }
        StringBuilder g = a.g("Bundle[{");
        for (String str : bundle.keySet()) {
            String str2;
            if (g.length() != 8) {
                g.append(", ");
            }
            g.append(x(str2));
            g.append(ContainerUtils.KEY_VALUE_DELIMITER);
            Object obj = bundle.get(str2);
            if (obj instanceof Bundle) {
                str2 = w(new Object[]{obj});
            } else if (obj instanceof Object[]) {
                str2 = w((Object[]) obj);
            } else if (obj instanceof ArrayList) {
                str2 = w(((ArrayList) obj).toArray());
            } else {
                str2 = String.valueOf(obj);
            }
            g.append(str2);
        }
        g.append("}]");
        return g.toString();
    }

    public final String t(zzaq zzaq) {
        if (!z()) {
            return zzaq.toString();
        }
        String str;
        StringBuilder g = a.g("origin=");
        g.append(zzaq.c);
        g.append(",name=");
        g.append(u(zzaq.a));
        g.append(",params=");
        zzap zzap = zzaq.b;
        if (zzap == null) {
            str = null;
        } else if (z()) {
            str = s(zzap.c());
        } else {
            str = zzap.toString();
        }
        g.append(str);
        return g.toString();
    }

    public final String u(String str) {
        if (str == null) {
            return null;
        }
        if (z()) {
            return v(str, v5.c, v5.a, c);
        }
        return str;
    }

    public final String w(Object[] objArr) {
        if (objArr == null) {
            return "[]";
        }
        StringBuilder g = a.g("[");
        for (Object obj : objArr) {
            String s;
            if (obj instanceof Bundle) {
                s = s((Bundle) obj);
            } else {
                s = String.valueOf(obj);
            }
            if (s != null) {
                if (g.length() != 1) {
                    g.append(", ");
                }
                g.append(s);
            }
        }
        g.append("]");
        return g.toString();
    }

    public final String x(String str) {
        if (str == null) {
            return null;
        }
        if (z()) {
            return v(str, u5.b, u5.a, d);
        }
        return str;
    }

    public final String y(String str) {
        if (str == null) {
            return null;
        }
        if (!z()) {
            return str;
        }
        if (!str.startsWith("_exp_")) {
            return v(str, x5.b, x5.a, e);
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("experiment_id");
        stringBuilder.append("(");
        stringBuilder.append(str);
        stringBuilder.append(")");
        return stringBuilder.toString();
    }

    public final boolean z() {
        return this.a.v() && this.a.d().x(3);
    }
}
